<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>templi后台管理系统</title>
    <link href="__PUBLIC__/css/admin/common.css" type="text/css" rel="stylesheet" />
    <link href="__PUBLIC__/css/admin/glxt.css" type="text/css" rel="stylesheet" />
    <link href="__PUBLIC__/js/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/uploadify/jquery.uploadify.min.js"></script>
    <style>
        .file_list{width: 600px;overflow: hidden;}
        .file_icon{width: 100px; height: 100px; border: #ccc 1px solid;padding: 2px;float: left;margin: 10px 8px;}
    </style>
</head>
<body>
    <div class="Main">
        <div class="listA">
            
        </div>
    </div>
    <div class="Main">
        <form action="{:U('Admin/Attachment/upload')}" method="post" enctype="multipart/form-data">
            <input id="file_upload" name="file_upload" type="file" />
            <input type="button"  value="上传" onclick="javascript:$('#file_upload').uploadify('upload','*')"/>
        </form>
        <div id="UploadFileList" class="file_list"></div>
    </div>
<script>
$(function($){
    $('#file_upload').uploadify({
        'swf'      : '__PUBLIC__/js/uploadify/uploadify.swf',
        'uploader' : "{:U('Admin/Attachment/upload')}",
        // Put your options here
        //'debug' :true,
        'auto'     : false,
        'multi'    : true,
        'method'   :'post',
        'queueSizeLimit':5,
        'removeCompleted':true,
        'rollover' :true,
        'formData':{'doupload':1},
        'sizeLimit':2000,
        'queueID'  : 'UploadFileList',
        'onFallback' : function() {
            alert('Flash was not detected.');
        },
        'onUploadError':function(file, errorCode, errorMsg, errorString){
            alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
        },
        'onUploadSuccess':function(file, data, response){
            //alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
            data = eval('(' +data+ ')');
            var html ='<div class="file_icon">';
            html += '<a href="javascript:;" onclick="javascript:att_cancel();">';
            html += '<img src="'+data.url+'" width="80" height="80" alt="'+data.filename+'" title="'+data.filename+'"/>';
            html += '</a></div>';
            $('#UploadFileList').append(html);
        },
        'onQueueComplete':function(queueData){
            for(var o in queueData){
                //alert(o+':'+queueData[o]);
            }
        }
    });
   
})
</script>
</body>
</html>